<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>专业录取线管理</title>
	<meta name="decorator" content="default"/>
</head>
<body>
<div class="main-content">
    <tags:breadcrumb menuId="专业录取线" />
    <div class="page-content">
    	<div class="search-block" style="display:none;">
			<form:form id="searchForm" modelAttribute="lqMajor" action="${ctx}/score/lqMajor/" method="post" class="form-horizontal">
			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
			<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
			<div class="form-group" style="margin-bottom: 0px;">
				<div class="col-sm-2">
					<form:input path="schoolName" htmlEscape="false" maxlength="20" class="col-sm-12" placeholder="学校名称"/>
				</div>
				<div class="col-sm-2">
					<form:select path="klType" class="col-sm-12">
						<form:option value="" label="--科类--"/>
						<form:options items="${fns:getDictList('kemu_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</div>
				<div class="col-sm-2">
					<form:select path="province" class="col-sm-12">
						<form:option value="" label="--省份--"/>
						<form:options items="${provinceList}" itemLabel="name" itemValue="code" htmlEscape="false"/>
					</form:select>
				</div>
				<div class="col-sm-2">
					<form:select path="batchLevel" class="col-sm-12">
						<form:option value="" label="-批次-"/>
						<form:options items="${fns:getDictList('batch_level')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</div>
				<div class="col-sm-2">
					<form:select path="lqYear" class="col-sm-8">
						<form:option value="" label="-年度-"/>
						<form:options items="${fns:getDictList('close_year')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</div>
				<div class="col-sm-2">
					<input id="btnSubmit" class="btn btn-primary btn-sm" type="submit" value="查询"/>
					<input id="btnExport" class="btn btn-inverse btn-sm" type="button" value="导出"/>
					<input id="btnImport" class="btn btn-warning btn-sm" type="button" value="导入"/>
				</div>
			</div>
		</form:form>
	</div>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th rowspan="2">学校</th>
				<th rowspan="2">专业</th>
				<th rowspan="2">省份</th>
				<th rowspan="2">科目</th>
				<th rowspan="2">批次</th>
				<th rowspan="2">年份</th>
				<th rowspan="2">等级</th>
				<th colspan="3" style="text-align: center;">录取分</th>
				<th colspan="3" style="text-align: center;">同位分</th>
				<th colspan="2" style="text-align: center;">计划人数</th>
				<th rowspan="2">专业线差</th>
				<th rowspan="2">更新时间</th>
				<shiro:hasPermission name="score:lqMajor:edit"><th rowspan="2">操作</th></shiro:hasPermission>
			</tr>
            <tr>
                <th>最低</th>
                <th>平均</th>
                <th>最高</th>
                <th>最低</th>
                <th>平均</th>
                <th>最高</th>
                <th>去年</th>
                <th>今年</th>
            </tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="lqMajor">
			<tr>
                <td>${lqMajor.schoolName}</td>
                <td>${lqMajor.majorName}</td>
                <td>${lqMajor.province}</td>
                <td>${fns:getDictLabel(lqMajor.klType,'kemu_type','')}</td>
                <td>${fns:getDictLabel(lqMajor.batchLevel,'batch_level','')}</td>
                <td>${fns:getDictLabel(lqMajor.lqYear,'close_year','')}</td>
                <td>${fns:getDictLabel(lqMajor.level,'lq_major_level','')}</td>
                <td>${lqMajor.lqMinScore}</td>
                <td>${lqMajor.lqAvrgScore}</td>
                <td>${lqMajor.lqMaxScore}</td>
                <td>${lqMajor.twfMinScore}</td>
                <td>${lqMajor.twfAvrgScore}</td>
                <td>${lqMajor.twfMaxScore}</td>
                <td>${lqMajor.lastYearNum}</td>
                <td>${lqMajor.thisYearNum}</td>
                <td>${lqMajor.diffScore}</td>
				<td>
					<fmt:formatDate value="${lqMajor.updateDate}" pattern="yyyy-MM-dd"/>
				</td>
				<shiro:hasPermission name="score:lqMajor:edit"><td>
    				<a href="${ctx}/score/lqMajor/form?id=${lqMajor.id}">修改</a>
					<a href="javascript:;" onclick="deleteMsg('确认要删除该专业录取线吗？', '${ctx}/score/lqMajor/delete?id=${lqMajor.id}' , this)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
    </div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title">专业录取分导入</h4>
			</div>
			<div class="modal-body">
				<form id="importForm" action="${ctx}/score/lqMajor/import" enctype="multipart/form-data"  method="post" class="form-horizontal">
					<div class="form-group">
						<label class="col-sm-2 no-padding-right control-label">模板名称:</label>
						<div class="col-sm-8">
							<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>
							<span class="important">*</span>
						</div>
						<div col-sm-2>
							<a href="${ctx}/score/lqMajor/import/template">下载模板</a>
						</div>
					</div><hr>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary" id="btnSureImport">确定</button>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function() {
        //显示高级查询
		$(".search-block").show();
        $(".search_link").click(function(){
            if($(".search-block").is(":visible")){
                $(".search-block").hide();
                $(".search_link").text("高级查询");
            }else{
                $(".search-block").show();
                $(".search_link").text("隐藏查询");
            }
        });

		//导出
		$("#btnExport").click(function(){
			layer.confirm("确认要导出专业录取分数据吗？",function(index){
				layer.close(index);
				$("#searchForm").attr("action","${ctx}/score/lqMajor/export");
				$("#searchForm").submit();
			});
		});

		//导入
		$("#btnImport").click(function(){
			$("#myModal").modal({
				backdrop:"static"
			});
		});

		$("#btnSureImport").click(function(){
			$("#importForm").submit();
		});
	});

	function deleteMsg(msg,href,tr){
		layer.confirm(msg,{icon:5,title:"温馨提示"},function(index){
			loading();
			layer.close(index);
			$.post(href,function(data){
				if(data.success){
					showNote("success", function () {
						$(tr).parent().parent().remove();
					}, data.msg, "center");
				}else {
					showNote("error", function () {
						return false;
					}, data.msg);
				}
			});
		});
	}

	function page(n,s){
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
</script>
</body>
</html>